import React, { Component } from 'react';
import { Redirect } from 'react-router-dom'
class Beforeeach extends Component {
	render() {
		const { component: Comp, children, path } = this.props
		const token = localStorage.getItem('token')

		// 跳转页面是不登录  并且  缓存中没有令牌
		// if (path !== '/login' && !token) {
		// 	return <Redirect to="/login"></Redirect>
		// }
		// 正常跳转
		return <Comp {...this.props} routes={children}></Comp>
	}
}

export default Beforeeach;
